﻿@model Football.ViewModels.GameViewModel
@{
    ViewBag.Title = "Midweek Football";
}
@section featured {
    <section class="featured">
        <div class="content-wrapper">
            <hgroup class="title">
                <h2>@Model.PlayerCountTitle</h2>
            </hgroup>
            <p>
                The next game will take place on <mark>@Model.StartDate</mark> at <mark>@Model.StartTime</mark>
            </p>

            @using (Html.BeginForm())
            {
    @Html.ValidationSummary()

    <fieldset>
        @Html.EditorFor(m => m.NewPlayerName)
        <input type="submit" value="Add Player!" />
    </fieldset>
            }
        </div>
    </section>
}
@Html.Partial("_PlayerList", Model)
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <script type="text/javascript">
        $(function () {

            $('#show-the-quitters').click(function () {
                $('#show-the-quitters').hide();
                $('#hide-the-quitters').show();
                $('.out').show();
            });

            $('#hide-the-quitters').click(function () {
                $('#hide-the-quitters').hide();
                $('#show-the-quitters').show();
                $('.out').hide();
            });

            $('.close').click(function () {
                var name = $(this).parent().find(".playername").text();
                if (confirm('Kick ' + name + ' from the game?')) {
                    $.post(this.href, function (json) {
                        $("#" + json.id).fadeTo("slow", 0.33);
                        $("#" + json.id + " .badge").text("out");
                        $("#NewPlayerName").text('');

                    });
                }
                return false;
            });
        });
    </script>
}
